package cn.kgc.author.service;

import cn.kgc.author.mapper.AuthorMapper;
import cn.kgc.common.entity.Author;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * Created by teacher ZHANG on 2022/12/5
 */
@Service
public class AuthorServiceImpl extends ServiceImpl<AuthorMapper, Author> implements AuthorService {
    @Override
    public Author findByUsername(String username) {
        QueryWrapper<Author> wrapper = new QueryWrapper<>();
        wrapper.eq("username", username);

        return getBaseMapper().selectOne(wrapper);
    }

    @Override
    public Author findByPhone(String phone) {
        QueryWrapper<Author> wrapper = new QueryWrapper<>();
        wrapper.eq("phone", phone);

        return getBaseMapper().selectOne(wrapper);
    }
}
